#include "stdafx.h"
#include "CommonAlgorithm.h"

bool FindInPartiallySortedMatrix(int *matrix, int rows, int columns, int number){
	bool find = false;
	if(matrix != NULL && rows >0 && columns > 0){
		int row = 0;
		int column = columns - 1;
		while( row < rows && column >= 0){
			if(matrix[row*columns + column] == number){
				find = true;
				break;
			}
			else if(matrix[row*columns + column] > number){
				column--;
			}else
				row++;
		}
	}
	return find;
}